package com.scud.order.controller;

import com.scud.common.result.Result;
import com.scud.model.PageDto;
import com.scud.model.PageResult;
import com.scud.model.order.vo.ManageOrderVo;
import com.scud.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author vermouth
 */
@RestController
@RequestMapping("/api/order/manage")
@Slf4j
public class ManageOrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 商家查询相关订单信息
     * @param dto:
     * @return Result
     * @author vermouth
     */
    @PostMapping("/orderPage")
    @PreAuthorize("hasAuthority('ORDER_LIST')")
    public Result orderPage(@RequestBody PageDto dto){
        log.info("商家查询相关订单信息：{}",dto);
        PageResult<ManageOrderVo> pageResult=orderService.manageOrderPage(dto);
        return Result.success(pageResult);

    }
}
